package com.fancy.learncenter.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.activity.YgtFreeDetailActivity;
import com.fancy.learncenter.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.adapter.base.CustomViewHold;
import com.fancy.learncenter.bean.YgtDataBean;
import com.superservice.lya.R;

import java.util.ArrayList;

/**
 * Created by hyy on 2018/2/24.
 * Explain activity as
 */

public class YiGouTongAdapter extends CommonRecycleViewAdapter<YgtDataBean.ListBean> {

    public String freeId;

    public YiGouTongAdapter(Context mContext, ArrayList<YgtDataBean.ListBean> itemDatas) {
        super(mContext, R.layout.activity_yigoutong_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final YgtDataBean.ListBean item, int position) {

        SimpleDraweeView simpleDraweeView = customViewHold.getView(R.id.simpleDraweeView);
        simpleDraweeView.setImageURI(item.getClassify_img());

        TextView title = customViewHold.getView(R.id.title);
        title.setText(item.getClassify_name());
        if (item.getClassify_name().equals("根管治疗")) {
            freeId = item.getId();
        }


        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onClickCallBack.onClick(item);
            }
        });
    }

    public OnClickCallBack getOnClickCallBack() {
        return onClickCallBack;
    }

    public void setOnClickCallBack(OnClickCallBack onClickCallBack) {
        this.onClickCallBack = onClickCallBack;
    }

    private OnClickCallBack onClickCallBack;

    public interface OnClickCallBack {
        abstract void onClick(YgtDataBean.ListBean item);

    }
}
